<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 * Description of NewsSectionType
 *
 * @author bien.tran
 */

namespace Blog\BlogBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;

class NewsCategoryType extends AbstractType {
    public function buildForm(FormBuilder $formBuildeer, array $options) {
        $formBuildeer->add('title', 'text', array('label' => 'Title Blog', 'required' => true));
        $formBuildeer->add('section', 'entity', array(
            'class' => '\BlogBundle\Entity\NewsSection',
            'label' => 'Section for category',
            'query_builder' => function (\Doctrine\ORM\EntityRepository $pdb) {
                return $pdb->createQueryBuilder('sec')->orderBy('sec.name');
            },
            'required' => true));
            $formBuildeer->add('active', 'choice', array('label' => 'Active', 'empty_value' => true));
    }
    public function getDefaultOptions(array $options) {
        return array('data_class' => 'Blog\BlogBundle\Entity\NewsCategory');
    }
    public function getName() {
        return 'blog_blogbundle_newscategorytype';
    }
}
?>
